package cn.t235.service;

import cn.t235.demo.Printer;
import org.junit.Test;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

import java.util.Arrays;

/**
 * @author 天天向上 （john.yi@qq.com）
 * @date 2020/10/28.
 */
public class UserServiceTest2 {
    private static ApplicationContext ctx = new ClassPathXmlApplicationContext("spring-config2.xml");

    @Test
    public void addBySpring() {
        UserService userService = (UserService) ctx.getBean("userService");
        int count = userService.add("bcsp");
        System.out.println(count);
    }
    @Test
    public void print() {
        Printer printer = (Printer) ctx.getBean("printer");
        printer.print("aaaa");
    }

}